﻿<phone:PhoneApplicationPage
    x:Class="WeiboPlus.Shell.Views.UserHomeView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:delay="clr-namespace:Delay;assembly=PhonePerformance"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
   
    SupportedOrientations="PortraitOrLandscape"
    Orientation="Portrait"
    d:DataContext="{d:DesignData /SampleData/UserHomeViewModelSampleData.xaml}"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    mc:Ignorable="d"
    d:DesignHeight="800"
    d:DesignWidth="480"
    shell:SystemTray.IsVisible="False">
    <Grid
        x:Name="LayoutRoot" Background="{StaticResource BackroundBrush}">

        <!--   <Rectangle Style="{StaticResource SpliterStyle}" />
     <Border Grid.RowSpan="2" Margin="0,140,0,0"  Background="{StaticResource BorderContainerBrush2}" BorderBrush="#FF413B3B"/>-->

        <!-- <Path
            VerticalAlignment="Top"
            Data="M20,20 L0,40 L40,40 Z"
            Fill="{StaticResource BorderContainerBrush1}"
            Margin="48,100,0,0" />-->
        <toolkit:PerformanceProgressBar x:Name="progressIndicator" IsIndeterminate="{Binding Loading}" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
        <controls:Pivot Name="pivot" Foreground="LightGray" Margin="10,10,10,0"
            SelectedIndex="{Binding PivotSelectedIndex,Mode=TwoWay}">
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Margin="0,40,0,0"
                            Text="{Binding UserHomePivotProfile, Source={StaticResource AppResx}}" VerticalAlignment="Bottom" FontSize="48" />
                </controls:PivotItem.Header>
                <Grid Margin="-10,-10,-10,0"
            Width="440">
                    <Grid.RowDefinitions>
                        <RowDefinition
                    Height="Auto" />
                        <RowDefinition
                    Height="Auto" />
                        <RowDefinition
                    Height="Auto" />
                        <RowDefinition
                    Height="Auto" />
                    </Grid.RowDefinitions>

                    <StackPanel
                Orientation="Horizontal"
                VerticalAlignment="Stretch"
                HorizontalAlignment="Stretch"
                Margin="2">
                        <Grid Margin="12,14,8,8" >
                            <Border VerticalAlignment="Top" BorderBrush="Black" Padding="4"  Background="WhiteSmoke" BorderThickness="1,1,2,2" >
                                <Image delay:LowProfileImageLoader.UriSource="{Binding UserProfileImageUrl}" Height="120" Width="120" Source="{Binding ProfileImage,Mode=TwoWay}" >
                                    <!--<Image.Clip>
                                    <RectangleGeometry
                            RadiusX="2"
                            RadiusY="2"
                            Rect="0,0,120,120" />
                                </Image.Clip>-->
                                </Image>
                            </Border>
                            <Image Source="{Binding User.ServiceProvider,Converter={StaticResource ProviderIconConverter}}" Margin="-4,-2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="22" Width="22"/>
                        </Grid>

                        <TextBlock
                    FontSize="32"
                    Margin="8,10,0,12"
                    VerticalAlignment="Top"
                    Text="{Binding User.Name}"
                    Foreground="{StaticResource PhoneAccentBrush}" />
                        <Image
                    Margin="2,22,0,12"
                    Height="24"
                    Visibility="{Binding User.Verified, Converter={StaticResource BoolToVisibilityConverter}}"
                    Width="24"
                    Source="/Icons/verify_icon.png"
                    VerticalAlignment="Top" />
                    </StackPanel>
                    <StackPanel
                VerticalAlignment="Bottom"
                Orientation="Vertical"
                Margin="12"
                Grid.Row="2">
                        <StackPanel Margin="0,12" Orientation="Horizontal">
                            <TextBlock  FontSize="32" Text="{Binding LocationText, Source={StaticResource AppResx}}" TextWrapping="Wrap"  Foreground="LightGray"  />
                        <TextBlock
                    Text="{Binding User.Location, StringFormat=': {0}'}"
                    TextWrapping="Wrap"
                    
                    Foreground="{StaticResource PhoneAccentBrush}"
                    Margin="18,0,0,0"  FontSize="32" />
                        </StackPanel>

                        <StackPanel  Margin="0,12" Orientation="Horizontal">
                            <TextBlock Text="{Binding StatusCountText, Source={StaticResource AppResx}}" TextWrapping="Wrap" Foreground="LightGray"  FontSize="32"  />
                            <TextBlock
                    Text="{Binding StatusesCount, StringFormat=': {0:N0}'}"
                    TextWrapping="Wrap"
                    FontSize="32"
                    Foreground="{StaticResource PhoneAccentBrush}"
                    Margin="18,0,0,0" />
                        </StackPanel>

                        <StackPanel  Margin="0,12" Orientation="Horizontal">
                            <TextBlock Text="{Binding FriendsText, Source={StaticResource AppResx}}" TextWrapping="Wrap" Foreground="LightGray"  FontSize="32"  />
                        <TextBlock
                    Text="{Binding User.FriendsCount, StringFormat=': {0:N0}'}"  FontSize="32" 
                    TextWrapping="Wrap"
                    Foreground="{StaticResource PhoneAccentBrush}"
                    Margin="18,0,0,0" />
                        </StackPanel>
                        <StackPanel Margin="0,12" Orientation="Horizontal">
                            <TextBlock FontSize="32" Text="{Binding FansText, Source={StaticResource AppResx}}" TextWrapping="Wrap" Foreground="LightGray"  />
                            <TextBlock FontSize="32" 
                    Text="{Binding User.FollowersCount, StringFormat=': {0:N0}'}"
                    TextWrapping="Wrap"
                    Foreground="{StaticResource PhoneAccentBrush}"
                    Margin="18,0,0,0" />
                        </StackPanel>
                          
                    </StackPanel>
                    <WeiboText Grid.Row="1" Margin="148,-100,0,0"
                Text="{Binding User.Description}" VerticalAlignment="Top" HorizontalAlignment="Stretch"
                TextWrapping="Wrap"
                Foreground="LightGray"
                 />
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Margin="0,40,0,0" Text="{Binding UserHomePivotTimeline, Source={StaticResource AppResx}}" VerticalAlignment="Bottom" FontSize="48" />
                </controls:PivotItem.Header>
                <ListBox
                    Margin="8,-2,0,0"
                    x:Name="tweetList"
                    Grid.Row="1"
                    SelectionChanged="OnStatusSelectionChanged"
                    ItemsSource="{Binding Items}"
                    ItemsPanel="{StaticResource ItemsPanelTemplate1}"
                    ItemTemplate="{StaticResource StatusListDataTemplateOfASingleUser}"
                    ItemContainerStyle="{StaticResource ListBoxItemContainerStyle}"  />
            </controls:PivotItem>
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Margin="0,40,0,0"
                            Text="{Binding FollowingText, Source={StaticResource AppResx}}"
                            VerticalAlignment="Bottom"
                            FontSize="48"
                             />
                </controls:PivotItem.Header>
                <ListBox Margin="8,-2,0,0"
                    x:Name="friendList"  ItemsPanel="{StaticResource ItemsPanelTemplate1}" 
                    SelectionChanged="OnUserSelectionChanged"
                    ItemsSource="{Binding Friends}"  ItemContainerStyle="{StaticResource ListBoxItemContainerStyle}" 
                    ItemTemplate="{StaticResource UserListDataTemplate}" />
            </controls:PivotItem>
            <controls:PivotItem>
                <controls:PivotItem.Header>
                        <TextBlock
                            Text="{Binding FansText, Source={StaticResource AppResx}}"
                            VerticalAlignment="Bottom"
                            FontSize="48"
                            Margin="0,40,0,0"/>
                </controls:PivotItem.Header>
                <ListBox
                    x:Name="followerList" Margin="8,-2,0,0" ItemContainerStyle="{StaticResource ListBoxItemContainerStyle}"  ItemsPanel="{StaticResource ItemsPanelTemplate1}"
                    SelectionChanged="OnUserSelectionChanged"
                    ItemsSource="{Binding Followers}"
                    ItemTemplate="{StaticResource UserListDataTemplate}" />
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsMenuEnabled="True" Opacity=".5" IsVisible="True">
            <shell:ApplicationBar.Buttons>
                <!--
                <shell:ApplicationBarIconButton x:Name="privateMessage" Click="privateMessage_Click" IconUri="/Images/AppBarIcons/appbar.tweet.bubble.update.png" Text="{StaticResource PrivateMessage}" />
                <shell:ApplicationBarIconButton x:Name="follow" Click="follow_Click" IconUri="/Images/AppBarIcons/appbar_follow.png" Text="{StaticResource FollowText}" />
                <shell:ApplicationBarIconButton x:Name="unfollow" Click="unfollow_Click" IconUri="/Images/AppBarIcons/appbar_unfollow.png" Text="{StaticResource UnfollowText}" />
                <shell:ApplicationBarIconButton x:Name="refresh" Click="refresh_Click" IconUri="/Images/AppBarIcons/refresh.png" Text="{StaticResource Refresh}" />
                -->
            </shell:ApplicationBar.Buttons>
            <shell:ApplicationBar.MenuItems>
                <!--
                <shell:ApplicationBarMenuItem Text="Home" Click="GoToHomePage" />
                -->
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
